package com.example.hw_cacaowithoutinputpicture;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.TabHost;

public class SubActivity extends FragmentActivity {

	TabHost mTabHost;
    TabManager mTabManager;
    Intent intent;
    
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_tab);
		
		intent = new Intent(SubActivity.this, ChattingActivity.class);
		
		mTabHost = (TabHost)findViewById(android.R.id.tabhost);
        mTabHost.setup();

        mTabManager = new TabManager(this, mTabHost, R.id.realtabcontent);

        mTabManager.addTab(mTabHost.newTabSpec("tab1").setIndicator("one"),
        		FragmentOne.class, null);
        mTabManager.addTab(mTabHost.newTabSpec("tab2").setIndicator("two"),
                FragmentTwo.class, null);
        mTabManager.addTab(mTabHost.newTabSpec("tab3").setIndicator("three"),
                FragmentThree.class, null);

//        mTabHost.setCurrentTab(2);
        
        if (savedInstanceState != null) {
            mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab"));
        }
	}

}
